Draft Functional Specifications by Ozwingle (Coefficients are not mentioned only because I am not knowledgeable enough to clearly describe them. However, including coefficients appears to be a good idea, as you have already done.)
Provide Compass Course (CC) calculated from True-Variation-Magnetic-Deviation-Compass (TVMDC) values. Provide for entry of a Deviation Table. Since OpenCPN 'knows' True and Variation (from WMM plugin), with Deviation we can have the Compass course to steer. Possibly integrate some of the functionality into OpenCPN core with WMM_pi.
While working on a new Compass Deviation plugin, What there is now:
A cellphone does have a fluxgate sensor just as most electronic compasses on board. And most fluxgate sensors are nowadays 3D that means they are actually three sensors (for x,y and z directions). A fluxgate is a way to measure magnetic field strength. For a compass we can forget about the z direction.
If we have a compass on board our ship, the reading is likely to be influenced by the ships own magnetic field. Think of this ships magnetic field as being a magnetic of some strength and in some direction. What an electronic compass does if the auto compensate feature is 'on', while steaming in a circle, measure the strength of the magnetic field. The field that is measured is the combination of earth and ships field. It is clear that if ships field and earth field are working in the same direction, the resulting total field will be high. Also if working in opposite direction the result will be low. Then the Compass computer starts calculating and makes an internal Correction Table based on the high and low course and a sinewave like correction between them. From then on it takes the compass readings, adds the Correction and outputs the Corrected Compass Course.
This works rather well for a lot of circumstances. But it could be that the ships magnetic field is equal or even stronger then the earth field. Then it is not possible to calulate a correction table. (your compass will warn you to find another place for the sensor). And especially on steel ships there is something like 'induced magnetic'. This is if the earth magnetic field 'sea's' a iron bar then, as the iron bar is a better magnetic conductor then air, the earth field will run trough the bar. Unfortunately we have now a bar with on one side magnetic field 'lines' going in and the other side coming out. that IS a magnet. Only a magnet not constant and even changing N/S poles on different courses.
Self Compensating Fluxgate compasses can't correct for these induced fields. Then there is still the Z direction. As long the vessel is upright this won't do anything to the compass reading. If sailing however it will cause a heeling error. And again an auto compensate can't fix this.
If you 'Compensate' (with magnets) a compass, or only make a 'Deviation Table', you need the true ships course (some way or another) and compare this with the compass reading.
In my Plugin (in progress) all three could be used and the PI will take care of the calculation and drawing of the deviation table. Dirk
Thanks for the specs. We are more or less on one line. As a point from your doc it will make it easier to add from an existing deviation table.
About your remarks about curve fitting and sine wave, the deviation is always a result of the formula
Dev=A + B.sin(CC) + C.cos(CC) + D.sin(2.CC) + E.cos(2.CC). Where CC is Compass Course and A to E constant values.
I do curve fitting following above formula and calculate the A..E values. In the preview the Curve including original points are visible, so you can see how accurate your input is/was.
Having the compass course in the route steering popup window is in the core code, and can't be changed from the plugin. But maybe in the future it is possible to merge with the variation plugin. Then it would be a standard addon for OpenCPN and the core code setting for magnetic-readings could be changed in compass-readings.
Note to Editors: For Plugin Documentation / User Guide. More information is given here.
First Menu, Enter Ship and Compass Name
Enter Compass Bearing and True Bearing
Calculation of Deviation Table and Graph
A. What does the pi do B. Why can the pi be useful
A. Where to get the pi B. How to install the pi
What are basic (standard) actions you have to do to make the pi work Example: “how to set up a Watchdog Alarm”.
What options are there after performing the standard actions Examples: 1. Choice for a specific type of Watchdog Alarm (anchor, boundary, speed, course, deadman, NMEA etc.) 2. Choice for a specific type of alarm-signal (pop-up message, sound, command) 3. Setting various parameters (range in meters, degrees, time in seconds or minutes, speed etc.)
Will this plugin help determine the deviation, or is it just for making the corrections? Will the compass indications include deviation with the assumption we are using a magnetic compass rather than a GPS compass?
Wouldn't a cellphone be useful to calibrate a compass? Their Compass often requires calibration by twisting in 3 directions?
What I try to do is allow to take bearings to a known point (is known bearing), and so find the misreading of the compass. The misreading is deviation + variation.
Cape Compass:Compass Deviation Analysis Explained
Far more detail here: